//
//  LoginViewController.swift
//  FM
//
//  Created by x on 2017/11/7.
//  Copyright © 2017年 HLB. All rights reserved.
//

import UIKit

class LoginViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()

        setupUI()
    }
    
    /// 初始化
    func setupUI() -> Void {
        view.backgroundColor = UIColor.white
        navigationItem.title = "登入"
        navigationItem.leftBarButtonItem = UIBarButtonItem.creatBarButtonItem(imageName: "back", target: self, action: #selector(backBtuClick))
        
        //1.添加View
        loginView.delegate = self
        view.addSubview(loginView)
    }
    
    func backBtuClick() -> Void {
        dismiss(animated: true, completion: nil)
    }
    
    
    private lazy var loginView:LoginView = LoginView(frame: CGRect.init(x: 0, y: 0, width: self.view.bounds.width, height: self.view.bounds.height))
    
}

extension LoginViewController:LoginViewDelegate {
    
    func setBtuDidClick(tag: Int) {
        switch tag {
        case 1:
            print("登入按钮")
            
        case 2:
            print("注册...")
            let registerVC = RegisterViewController()
            navigationController?.pushViewController(registerVC, animated: true)
            
        case 3:
            print("忘记密码...")
            let forgetPwdVC = ForgetPwdViewController()
            navigationController?.pushViewController(forgetPwdVC, animated: true)
            
        default:
            break
        }
    }
}
